home *** CD-ROM | disk | FTP | other *** search
/ Champak 26 (Anniversary Edition) / Volume 26 [Anniversary Edition] - JOGO DISK .iso / DEPOSITO / REmovido / Nave / MarsFighter.swf / scripts / frame_665 / DoAction_2.as next >
Text File  |  2006-06-13  |  28KB  |  1,047 lines

  1. function kretanje_uspravno(i, k_x, k_y, flag, f)
  2. {
  3.    if(_root["au" + i])
  4.    {
  5.       if(flag == 0 && _root["au" + i]._y <= k_y)
  6.       {
  7.          _root["au" + i]._y += 7;
  8.          _root["au" + i]._x = k_x - 50;
  9.       }
  10.       if(flag == 0 && _root["au" + i]._y > k_y)
  11.       {
  12.          flag = 1;
  13.       }
  14.       if(flag == 1)
  15.       {
  16.          f += 0.1;
  17.          x = Math.cos(f) * 50;
  18.          y = Math.sin(f) * 50;
  19.          if(_root["au" + i]._x > k_x)
  20.          {
  21.             _root["au" + i]._rotation = Math.cos(f) * 90;
  22.          }
  23.          else
  24.          {
  25.             _root["au" + i]._rotation = (- Math.cos(f)) * 90 + 180;
  26.          }
  27.          _root["au" + i]._x = k_x + y;
  28.          _root["au" + i]._y = k_y + x;
  29.       }
  30.       if(flag == 1 && _root["au" + i]._x > k_x + 49)
  31.       {
  32.          flag = 2;
  33.       }
  34.       if(flag == 2)
  35.       {
  36.          _root["au" + i]._rotation = 0;
  37.          _root["au" + i]._y -= 7;
  38.          _root["au" + i]._x = k_x + 50;
  39.          if(_root["au" + i]._y < -10)
  40.          {
  41.             _root["au" + i].play();
  42.          }
  43.       }
  44.       _global["niz_uspravno" + i] = [k_x,k_y,flag,f];
  45.    }
  46.    if(!_root.boss1 && _global.unistenih_au == 3 && !_global.poginuo)
  47.    {
  48.       _root.osvezi_au();
  49.    }
  50. }
  51. function osvezi_au()
  52. {
  53.    _global.unistenih_au = 0;
  54.    k_x = random(300) + 100;
  55.    k_y = random(300) + 100;
  56.    i = 1;
  57.    while(i < 4)
  58.    {
  59.       duplicateMovieClip(_root.au,"au" + i,16384 + (100 + i));
  60.       _root["au" + i]._rotation = 180;
  61.       _root["au" + i].gotoAndStop(1);
  62.       _root["au" + i]._y = -70 - 50 * i;
  63.       _global["niz_uspravno" + i] = [k_x,k_y,0,-215.05];
  64.       i++;
  65.    }
  66. }
  67. function kretanje_8(i, k_x, k_y, flag, f)
  68. {
  69.    if(_root["av" + i])
  70.    {
  71.       if(flag == 0 && _root["av" + i]._x >= k_x)
  72.       {
  73.          _root["av" + i]._x -= 7;
  74.          _root["av" + i]._y = k_y - 50;
  75.       }
  76.       if(flag == 0 && _root["av" + i]._x < k_x)
  77.       {
  78.          flag = 1;
  79.       }
  80.       if(flag == 1)
  81.       {
  82.          f += 0.17;
  83.          x = Math.cos(f) * 50;
  84.          y = Math.sin(f) * 50;
  85.          if(_root["av" + i]._x > k_x)
  86.          {
  87.             _root["av" + i]._rotation = Math.cos(f) * 90;
  88.          }
  89.          else
  90.          {
  91.             _root["av" + i]._rotation = (- Math.cos(f)) * 90 + 180;
  92.          }
  93.          _root["av" + i]._x = k_x + y;
  94.          _root["av" + i]._y = k_y + x;
  95.       }
  96.       if(flag == 1 && _root["av" + i]._y < k_y - 49)
  97.       {
  98.          flag = 2;
  99.       }
  100.       if(flag == 2)
  101.       {
  102.          _root["av" + i]._x -= 7;
  103.          _root["av" + i]._y = k_y - 50;
  104.          if(_root["av" + i]._x < -10)
  105.          {
  106.             _root["av" + i].play();
  107.          }
  108.       }
  109.       _global["niz_8" + i] = [k_x,k_y,flag,f];
  110.    }
  111.    if(!_root.boss1 && _global.unistenih_av == 3 && !_global.poginuo)
  112.    {
  113.       _root.osvezi_8();
  114.    }
  115. }
  116. function osvezi_8()
  117. {
  118.    _global.unistenih_av = 0;
  119.    k_x = random(200) + 150;
  120.    k_y = 100 + random(400);
  121.    i = 1;
  122.    while(i < 4)
  123.    {
  124.       duplicateMovieClip(_root.av,"av" + i,16384 + (200 + i));
  125.       _root["av" + i]._rotation = -90;
  126.       _root["av" + i].gotoAndStop(1);
  127.       _root["av" + i]._x = 550 + 50 * i;
  128.       _global["niz_8" + i] = [k_x,k_y,0,59.83];
  129.       i++;
  130.    }
  131. }
  132. function kretanje_atg_l(i, k_x, k_y, flag, f)
  133. {
  134.    if(_root["atg_l" + i])
  135.    {
  136.       if(flag == 0 && _root["atg_l" + i]._y <= k_y)
  137.       {
  138.          _root["atg_l" + i]._y += 7;
  139.          _root["atg_l" + i]._x = k_x - 100;
  140.       }
  141.       if(flag == 0 && _root["atg_l" + i]._y > k_y)
  142.       {
  143.          flag = 1;
  144.       }
  145.       if(flag == 1)
  146.       {
  147.          f += 0.07;
  148.          x = Math.cos(f) * 100;
  149.          y = Math.sin(f) * 100;
  150.          if(_root["atg_l" + i]._x < k_x)
  151.          {
  152.             _root["atg_l" + i]._x = k_x + y;
  153.             _root["atg_l" + i]._y = k_y + x;
  154.             _root["atg_l" + i]._rotation = (- Math.cos(f)) * 90 + 180;
  155.          }
  156.          else
  157.          {
  158.             _root["atg_l" + i]._rotation = Math.cos(f) * -90 + 180;
  159.             _root["atg_l" + i]._x = k_x + y;
  160.             _root["atg_l" + i]._y = k_y + 200 - x;
  161.          }
  162.       }
  163.       if(flag == 1 && _root["atg_l" + i]._x > k_x + 99)
  164.       {
  165.          flag = 2;
  166.       }
  167.       if(flag == 2)
  168.       {
  169.          _root["atg_l" + i]._rotation = 180;
  170.          _root["atg_l" + i]._y += 7;
  171.          _root["atg_l" + i]._x = k_x + 100;
  172.          if(_root["atg_l" + i]._y > 510)
  173.          {
  174.             _root["atg_l" + i].play();
  175.          }
  176.       }
  177.       _global["niz_atg_l" + i] = [k_x,k_y,flag,f];
  178.    }
  179.    if(!_root.boss1 && _global.unistenih_atg_l == 3 && !_global.poginuo)
  180.    {
  181.       _root.osvezi_atg_l();
  182.    }
  183. }
  184. function osvezi_atg_l()
  185. {
  186.    _global.unistenih_atg_l = 0;
  187.    k_x = random(250) + 100;
  188.    k_y = random(300) + 100;
  189.    i = 1;
  190.    while(i < 4)
  191.    {
  192.       duplicateMovieClip(_root.atg,"atg_l" + i,16384 + (300 + i));
  193.       _root["atg_l" + i]._rotation = 180;
  194.       _root["atg_l" + i].gotoAndStop(1);
  195.       _root["atg_l" + i]._y = -70 - 50 * i;
  196.       _global["niz_atg_l" + i] = [k_x,k_y,0,-215.15];
  197.       i++;
  198.    }
  199. }
  200. function detektovanje_sudara_aliena()
  201. {
  202.    k = 1;
  203.    while(k < 10)
  204.    {
  205.       objekat = _global.al_niz[k];
  206.       if(_root[objekat])
  207.       {
  208.          if(Math.abs(_root[objekat]._y - _root.ja._y) < 50)
  209.          {
  210.             if(_root[objekat].hitTest(_root.ja))
  211.             {
  212.                if(_root.ja._currentframe == 1 && _root[objekat]._currentframe == 1)
  213.                {
  214.                   _root.unisti_aliena(objekat,"mali");
  215.                   fire.start();
  216.                   _root.skindanje_hitpoena("avion","hit_poen");
  217.                   _global.points += 30;
  218.                }
  219.             }
  220.             if(_root[objekat].hitTest(_root.ja))
  221.             {
  222.                if(_root.ja._currentframe == 2 && _root[objekat]._currentframe == 1)
  223.                {
  224.                   _root.unisti_aliena(objekat,"mali");
  225.                   fire.start();
  226.                   _global.points += 30;
  227.                   _root.skindanje_hitpoena("avion","stit");
  228.                }
  229.             }
  230.          }
  231.       }
  232.       k++;
  233.    }
  234. }
  235. function unisti_aliena(objekat, tip, sredstvo)
  236. {
  237.    if(tip === "mali")
  238.    {
  239.       _root[objekat].play();
  240.    }
  241. }
  242. function skindanje_hitpoena(sredstvo, sa)
  243. {
  244.    switch(sa)
  245.    {
  246.       case "hit_poen":
  247.          switch(sredstvo)
  248.          {
  249.             case "avion":
  250.                _global.moji_hitpoeni -= 5;
  251.                break;
  252.             case "metak":
  253.                _global.moji_hitpoeni -= 1;
  254.                break;
  255.             case "sr_metak":
  256.                _global.moji_hitpoeni -= 2;
  257.                break;
  258.             case "boss_metak":
  259.                _global.moji_hitpoeni -= 5;
  260.          }
  261.          break;
  262.       case "stit":
  263.          switch(sredstvo)
  264.          {
  265.             case "avion":
  266.                _global.moj_stit -= 5;
  267.                _root.postavljanje_stita();
  268.                break;
  269.             case "metak":
  270.                _global.moj_stit -= 1;
  271.                _root.postavljanje_stita();
  272.                break;
  273.             case "sr_metak":
  274.                _global.moj_stit -= 2;
  275.                _root.postavljanje_stita();
  276.                break;
  277.             case "boss_metak":
  278.                _global.moj_stit -= 5;
  279.                _root.postavljanje_stita();
  280.          }
  281.    }
  282. }
  283. function postavljanje_stita()
  284. {
  285.    if(_global.moj_stit > 0)
  286.    {
  287.       _root.ja.gotoAndStop(2);
  288.    }
  289.    else
  290.    {
  291.       _root.ja.play();
  292.    }
  293. }
  294. function kretanjeMetaka()
  295. {
  296.    k = 1;
  297.    while(k < _global.br_metkova + 1)
  298.    {
  299.       _root["m" + k]._y -= 18;
  300.       if(_root["m" + k]._y < 60)
  301.       {
  302.          _root.unisti_metak(k);
  303.       }
  304.       k++;
  305.    }
  306. }
  307. function space_dilej()
  308. {
  309.    _global.brojac_space = _global.brojac_space + 1;
  310.    if(_global.brojac_space == 4)
  311.    {
  312.       _global.space = 24;
  313.       _global.brojac_space = 0;
  314.    }
  315. }
  316. function unisti_metak(br)
  317. {
  318.    _root["m" + br]._x = _root["m" + _global.br_metkova]._x;
  319.    _root["m" + br]._y = _root["m" + _global.br_metkova]._y;
  320.    removeMovieClip(_root["m" + _global.br_metkova]);
  321.    _global.br_metkova--;
  322. }
  323. function space()
  324. {
  325.    if(_global.spaceset == 1 && _global.space == 24 && _global.keyCont)
  326.    {
  327.       _global.br_metkova = _global.br_metkova + 1;
  328.       duplicateMovieClip(_root.m,"m" + _global.br_metkova,16384 + _global.m_depth);
  329.       if(_global.m_depth == 900)
  330.       {
  331.          _global.m_depth = 500;
  332.       }
  333.       else
  334.       {
  335.          _global.m_depth = _global.m_depth + 1;
  336.       }
  337.       _root["m" + _global.br_metkova]._x = _root.ja._x;
  338.       _root["m" + _global.br_metkova]._y = _root.ja._y;
  339.       moj_strelk.start();
  340.       _global.space = 0;
  341.       _global.spaceset = 0;
  342.    }
  343. }
  344. function stisnut_space()
  345. {
  346.    if(Key.isDown(32))
  347.    {
  348.       _global.spaceset = 1;
  349.    }
  350. }
  351. function provera_pogotka()
  352. {
  353.    r = 1;
  354.    while(r < 10)
  355.    {
  356.       k = 1;
  357.       while(k < _global.br_metkova + 1)
  358.       {
  359.          objekat = _global.al_niz[r];
  360.          if(Math.abs(_root[objekat]._y - _root["m" + k]._y) < 30 && Math.abs(_root[objekat]._x - _root["m" + k]._x) < 30)
  361.          {
  362.             if(_root[objekat]._currentframe == 1)
  363.             {
  364.                _root.unisti_metak(k);
  365.                _root[objekat].play();
  366.                fire.start();
  367.                _global.points += 30;
  368.             }
  369.          }
  370.          k++;
  371.       }
  372.       r++;
  373.    }
  374.    if(_root.boss1)
  375.    {
  376.       k = 1;
  377.       while(k < _global.br_metkova + 1)
  378.       {
  379.          if(Math.abs(_root.boss1._y - _root["m" + k]._y) < 100)
  380.          {
  381.             if(_root.boss1._currentframe == 1)
  382.             {
  383.                if(_root["m" + k].hitTest(_root.boss1))
  384.                {
  385.                   _root.unisti_metak(k);
  386.                   _global.boss1_hitpoeni--;
  387.                }
  388.             }
  389.          }
  390.          k++;
  391.       }
  392.    }
  393. }
  394. function alien_trazenje()
  395. {
  396.    _global.snap_random--;
  397.    if(_global.snap_random == 0)
  398.    {
  399.       i = random(_global.al_niz_br.length);
  400.       br = _global.al_niz_br[i];
  401.       objekat = _global.al_niz[br];
  402.       _root.alien_racunaj(br,objekat);
  403.       _global.ispaljenih_al_m = _global.ispaljenih_al_m + 1;
  404.       _global.al_niz_br.splice(i,1);
  405.       _global.snap_random = _global.pucanje;
  406.    }
  407. }
  408. function alien_gadjanje(br)
  409. {
  410.    if(_global["ispaljivanje" + br] == true)
  411.    {
  412.       i = 5;
  413.       while(i > 0)
  414.       {
  415.          _root["al_m" + br]._y += _global["nap_y" + br];
  416.          _root["al_m" + br]._x += _global["nap_x" + br];
  417.          i--;
  418.       }
  419.       if(_root["al_m" + br]._x > 500)
  420.       {
  421.          removeMovieClip(_root["al_m" + br]);
  422.       }
  423.       if(_root["al_m" + br]._x < -100)
  424.       {
  425.          removeMovieClip(_root["al_m" + br]);
  426.       }
  427.       if(_root["al_m" + br]._y > 600)
  428.       {
  429.          removeMovieClip(_root["al_m" + br]);
  430.       }
  431.       if(_root["al_m" + br]._y < -100)
  432.       {
  433.          removeMovieClip(_root["al_m" + br]);
  434.       }
  435.    }
  436. }
  437. function alien_racunaj(br, objekat)
  438. {
  439.    duplicateMovieClip(_root.al_m,"al_m" + br,16384 + (400 + br));
  440.    _root["al_m" + br]._x = _root[objekat]._x;
  441.    _root["al_m" + br]._y = _root[objekat]._y;
  442.    x_razlika = _root.ja._x - _root["al_m" + br]._x;
  443.    y_razlika = _root.ja._y - _root["al_m" + br]._y;
  444.    y_br_koraka = Math.abs(y_razlika * 0.5);
  445.    x_br_koraka = Math.abs(x_razlika * 0.5);
  446.    srednji_br_koraka = Math.round((x_br_koraka + y_br_koraka) / 2);
  447.    _global["nap_x" + br] = x_razlika / srednji_br_koraka;
  448.    _global["nap_y" + br] = y_razlika / srednji_br_koraka;
  449.    if(_root[objekat]._x > 20 && _root[objekat]._x < 400 && _root[objekat]._y < 400 && _root[objekat]._y > 20)
  450.    {
  451.       _root["al_m" + br]._alpha = 100;
  452.       _global["ispaljivanje" + br] = true;
  453.    }
  454.    else
  455.    {
  456.       _root["al_m" + br]._alpha = 0;
  457.    }
  458. }
  459. function alien_pogodak(br)
  460. {
  461.    if(Math.abs(_root["al_m" + br]._y - _root.ja._y) < 30)
  462.    {
  463.       if(Math.abs(_root["al_m" + br]._x - _root.ja._x) < 30)
  464.       {
  465.          if(_root.ja._currentframe == 1)
  466.          {
  467.             if(_root["al_m" + br]._alpha == 100)
  468.             {
  469.                _root.skindanje_hitpoena("metak","hit_poen");
  470.                removeMovieClip(_root["al_m" + br]);
  471.                thumph.start();
  472.             }
  473.          }
  474.          if(_root.ja._currentframe == 2)
  475.          {
  476.             if(_root["al_m" + br]._alpha == 100)
  477.             {
  478.                _root.skindanje_hitpoena("metak","stit");
  479.                removeMovieClip(_root["al_m" + br]);
  480.                thumph.start();
  481.             }
  482.          }
  483.       }
  484.    }
  485. }
  486. function detektovanje_sudara_bombe(sr_bomba)
  487. {
  488.    k = 1;
  489.    while(k < 10)
  490.    {
  491.       objekat = _global.al_niz[k];
  492.       if(_root[objekat])
  493.       {
  494.          if(Math.abs(_root[objekat]._y - _root.bomba1._y) < 50)
  495.          {
  496.             if(_root.bomba1._currentframe == 1)
  497.             {
  498.                if(_root[objekat].hitTest(_root.bomba1))
  499.                {
  500.                   _root.bomba1.play();
  501.                   explode.start();
  502.                }
  503.             }
  504.          }
  505.          if(_root.bomba1._currentframe > 4)
  506.          {
  507.             _global.bomba_ispaljena = false;
  508.             if(_root[objekat].hitTest(_root.bomba1))
  509.             {
  510.                _root[objekat].play();
  511.                fire.start();
  512.                _global.points += 30;
  513.             }
  514.          }
  515.       }
  516.       k++;
  517.    }
  518.    if(_root.srednji)
  519.    {
  520.       if(Math.abs(_root.srednji._y - _root.bomba1._y) < 100)
  521.       {
  522.          if(_root.srednji._currentframe == 32)
  523.          {
  524.             if(_root.bomba1._currentframe == 1)
  525.             {
  526.                if(_root.srednji.hitTest(_root.bomba1))
  527.                {
  528.                   _global.bomba_ispaljena = false;
  529.                   _root.bomba1.play();
  530.                   explode.start();
  531.                }
  532.             }
  533.             if(_root.bomba1._currentframe > 4)
  534.             {
  535.                if(sr_bomba)
  536.                {
  537.                   if(_root.srednji.hitTest(_root.bomba1))
  538.                   {
  539.                      _global.srednji_hitpoen -= 6;
  540.                      _global.sr_bomba = false;
  541.                   }
  542.                }
  543.             }
  544.          }
  545.       }
  546.    }
  547.    if(_root.boss1)
  548.    {
  549.       if(Math.abs(_root.boss1._y - _root.bomba1._y) < 150)
  550.       {
  551.          if(_root.boss1._currentframe == 1)
  552.          {
  553.             if(_root.bomba1._currentframe == 1)
  554.             {
  555.                if(_root.boss1.hitTest(_root.bomba1))
  556.                {
  557.                   _global.bomba_ispaljena = false;
  558.                   _root.bomba1.play();
  559.                   explode.start();
  560.                }
  561.             }
  562.             if(_root.bomba1._currentframe > 4)
  563.             {
  564.                if(_global.boss1_bomba)
  565.                {
  566.                   if(_root.boss1.hitTest(_root.bomba1))
  567.                   {
  568.                      _global.boss1_hitpoeni -= 6;
  569.                      _global.boss1_bomba = false;
  570.                   }
  571.                }
  572.             }
  573.          }
  574.       }
  575.    }
  576. }
  577. function kretanje_bombe()
  578. {
  579.    _root.bomba1._y -= 18;
  580.    _root.bomba1._alpha = 100;
  581.    if(_root.bomba1._y < 100)
  582.    {
  583.       _global.bomba_ispaljena = false;
  584.       _root.bomba1.play();
  585.       explode.start();
  586.    }
  587. }
  588. function kretanje_beama()
  589. {
  590.    _root.beam1._y -= 24;
  591.    _root.beam1._alpha = 100;
  592.    if(_root.beam1._y < 0)
  593.    {
  594.       _global.beam_ispaljen = false;
  595.       removeMovieClip(_root.beam1);
  596.    }
  597. }
  598. function ispaljivanje_bombe(b)
  599. {
  600.    if(b == 65)
  601.    {
  602.       duplicateMovieClip(_root.bombaOBJ,"bomba1",17586);
  603.       _root.bomba1._x = _root.ja._x;
  604.       _root.bomba1._y = _root.ja._y;
  605.       _root.bomba1._alpha = 100;
  606.       _global.sr_bomba = true;
  607.       _global.boss1_bomba = true;
  608.       _global.bomba_ispaljena = true;
  609.    }
  610.    if(b == 66)
  611.    {
  612.       duplicateMovieClip(_root.beamOBJ,"beam1",17485);
  613.       _root.beam1._alpha = 0;
  614.       _root.beam1._x = _root.ja._x;
  615.       _root.beam1._y = _root.ja._y;
  616.       _global.sr_beam = true;
  617.       _global.boss_beam = true;
  618.       _global.beam_ispaljen = true;
  619.       strelk1.start();
  620.    }
  621. }
  622. function detektovanje_sudara_beama(sr_beam)
  623. {
  624.    k = 1;
  625.    while(k < 10)
  626.    {
  627.       objekat = _global.al_niz[k];
  628.       if(_root[objekat])
  629.       {
  630.          if(Math.abs(_root[objekat]._y - _root.beam1._y) < 50)
  631.          {
  632.             if(_root[objekat].hitTest(_root.beam1))
  633.             {
  634.                _root[objekat].play();
  635.                _global.points += 30;
  636.                fire.start();
  637.             }
  638.          }
  639.       }
  640.       k++;
  641.    }
  642.    if(_root.srednji && sr_beam)
  643.    {
  644.       if(Math.abs(_root.srednji._y - _root.beam1._y) < 50)
  645.       {
  646.          if(_root.srednji._currentframe == 32)
  647.          {
  648.             if(_root.beam1.hitTest(_root.srednji))
  649.             {
  650.                _global.sr_beam = false;
  651.                _global.srednji_hitpoen -= 3;
  652.             }
  653.          }
  654.       }
  655.    }
  656.    if(_root.boss1 && _global.boss_beam)
  657.    {
  658.       if(Math.abs(_root.boss1._y - _root.beam1._y) < 100)
  659.       {
  660.          if(_root.boss1._currentframe == 1)
  661.          {
  662.             if(_root.beam1.hitTest(_root.boss1))
  663.             {
  664.                _global.boss_beam = false;
  665.                _global.boss1_hitpoeni -= 3;
  666.             }
  667.          }
  668.       }
  669.    }
  670. }
  671. function set_glava()
  672. {
  673.    _root.glava1.Top = "top:" + _global.tops;
  674.    _root.glava1.Ime = _global.Ime;
  675.    if(_global.moji_hitpoeni < 0)
  676.    {
  677.       _global.lives--;
  678.       if(_global.lives > 0)
  679.       {
  680.          _global.moji_hitpoeni = 75;
  681.          _root.ja.gotoAndPlay(14);
  682.       }
  683.       else
  684.       {
  685.          _global.victory = false;
  686.          _global.teleport = true;
  687.          _root.ja.gotoAndPlay(14);
  688.       }
  689.    }
  690.    if(_root.boss1)
  691.    {
  692.       if(_global.boss1_hitpoeni < 0)
  693.       {
  694.          _root.boss1.play();
  695.       }
  696.       else
  697.       {
  698.          _root.glava1.boss1_hitbar1._alpha = 100;
  699.          boss1_stanje = _global.boss1_hitpoeni * 100 / 60;
  700.          _root.glava1.boss1_hitbar1.pokrivac_bosshita1._x = _root.glava1.boss1_hitbar1.boss1_hit1._x + boss1_stanje;
  701.       }
  702.    }
  703.    if(_global.moj_stit < 0)
  704.    {
  705.       _global.moj_stit = 0;
  706.    }
  707.    _root.glava1.beam = _global.beama_u_sarzeru;
  708.    _root.glava1.stit = _global.moj_stit;
  709.    stanje = _global.moji_hitpoeni * 100 / 75;
  710.    _root.glava1.moj_hitbar.pokrivac_mog_hita._x = _root.glava1.moj_hitbar.moj_hit._x + stanje;
  711.    _root.glava1.bomba = _global.bombi_u_sarzeru;
  712.    _root.glava1.points = "rezultat: " + _global.points;
  713.    _root.glava1.ja = _global.lives;
  714. }
  715. function kretanje_srednjeg(flag)
  716. {
  717.    if(flag == 1)
  718.    {
  719.       _root.srednji._y -= 1;
  720.    }
  721.    if(flag == 1 && _root.srednji._y < 400)
  722.    {
  723.       flag = 2;
  724.       _root.srednji.play();
  725.    }
  726.    if(flag == 2)
  727.    {
  728.       _root.srednji._y -= 1;
  729.       _root.srednji._x -= 1;
  730.    }
  731.    if(flag == 2 && _root.srednji._y < 350)
  732.    {
  733.       flag = 3;
  734.    }
  735.    if(flag == 3)
  736.    {
  737.       _root.srednji._y -= 1;
  738.    }
  739.    if(flag == 3 && _root.srednji._y < 150)
  740.    {
  741.       flag = 4;
  742.    }
  743.    if(flag == 4)
  744.    {
  745.       _root.srednji._y -= 1;
  746.       _root.srednji._x += 1;
  747.    }
  748.    if(_root.srednji._y < -20)
  749.    {
  750.       removeMovieClip(_root.srednji);
  751.       _global.srednji_timer = 60;
  752.       flag = 1;
  753.    }
  754.    if(_root.srednji._x < -40)
  755.    {
  756.       removeMovieClip(_root.srednji);
  757.       _global.srednji_timer = 60;
  758.       flag = 1;
  759.    }
  760.    if(_global.srednji_hitpoen < 0)
  761.    {
  762.       if(_root.srednji._currentframe == 32)
  763.       {
  764.          _global.srednji_hitpoen = 0;
  765.          _global.points += 1000;
  766.          _root.srednji.play();
  767.          fire.start();
  768.          _global.srednji_timer = 60;
  769.          flag = 1;
  770.       }
  771.    }
  772.    _global.srednji_flag = flag;
  773.    k = 1;
  774.    while(k < _global.br_metkova + 1)
  775.    {
  776.       if(Math.abs(_root["m" + k]._y - _root.srednji._y) < 50)
  777.       {
  778.          if(_root.srednji._currentframe == 32)
  779.          {
  780.             if(_root["m" + k].hitTest(_root.srednji))
  781.             {
  782.                _root.unisti_metak(k);
  783.                _global.srednji_hitpoen--;
  784.             }
  785.          }
  786.       }
  787.       k++;
  788.    }
  789.    if(Math.abs(_root.ja._y - _root.srednji._y) < 50)
  790.    {
  791.       if(_root.srednji._currentframe == 32)
  792.       {
  793.          if(_root.ja.hitTest(_root.srednji))
  794.          {
  795.             if(_root.ja._currentframe == 1)
  796.             {
  797.                _root.skindanje_hitpoena("avion","hit_poen");
  798.             }
  799.             if(_root.ja._currentframe == 2)
  800.             {
  801.                _root.skindanje_hitpoena("avion","stit");
  802.             }
  803.             if(!_global.hitTest_sr)
  804.             {
  805.                _global.hitTest_sr = true;
  806.                _global.srednji_hitpoen -= 5;
  807.             }
  808.          }
  809.          else
  810.          {
  811.             _global.hitTest_sr = false;
  812.          }
  813.       }
  814.    }
  815. }
  816. function pucanje_srednjeg(sr_p_timer)
  817. {
  818.    if(_root.srednji._currentframe == 32 && !_global.poginuo)
  819.    {
  820.       sr_p_timer--;
  821.    }
  822.    if(sr_p_timer == 0)
  823.    {
  824.       sr_p_timer = 36;
  825.       i = 1;
  826.       while(i < 4)
  827.       {
  828.          removeMovieClip(_root["sr_alm" + i]);
  829.          duplicateMovieClip(_root.al_m,"sr_alm" + i,16384 + (330 + i));
  830.          _root["sr_alm" + i]._y = _root.srednji._y;
  831.          _root["sr_alm" + i]._x = _root.srednji._x;
  832.          i++;
  833.       }
  834.       x_razlika = _root.ja._x - _root.sr_alm1._x;
  835.       y_razlika = _root.ja._y - _root.sr_alm1._y;
  836.       y_br_koraka = Math.abs(y_razlika * 0.5);
  837.       x_br_koraka = Math.abs(x_razlika * 0.5);
  838.       srednji_br_koraka = Math.round((x_br_koraka + y_br_koraka) / 2);
  839.       _global.nap_xsr1 = x_razlika / srednji_br_koraka;
  840.       _global.nap_ysr1 = y_razlika / srednji_br_koraka;
  841.       k = 2;
  842.       while(k < 4)
  843.       {
  844.          _global["nap_ysr" + k] = _global.nap_ysr1 * (k / 3);
  845.          _global["nap_xsr" + k] = _global.nap_xsr1 * (k / 1.5);
  846.          k++;
  847.       }
  848.    }
  849.    t = 1;
  850.    while(t < 4)
  851.    {
  852.       if(_root["sr_alm" + t])
  853.       {
  854.          _root["sr_alm" + t]._y += _global["nap_ysr" + t] * 4;
  855.          _root["sr_alm" + t]._x += _global["nap_xsr" + t] * 4;
  856.          if(Math.abs(_root["sr_alm" + t]._y - _root.ja._y) < 50)
  857.          {
  858.             if(_root["sr_alm" + t].hitTest(_root.ja))
  859.             {
  860.                if(_root.ja._currentframe == 1)
  861.                {
  862.                   _root.skindanje_hitpoena("sr_metak","hit_poen");
  863.                   removeMovieClip(_root["sr_alm" + t]);
  864.                   thumph.start();
  865.                }
  866.                if(_root.ja._currentframe == 2)
  867.                {
  868.                   _root.skindanje_hitpoena("sr_metak","stit");
  869.                   removeMovieClip(_root["sr_alm" + t]);
  870.                   thumph.start();
  871.                }
  872.             }
  873.          }
  874.       }
  875.       t++;
  876.    }
  877.    _global.sr_p_timer = sr_p_timer;
  878. }
  879. function boss()
  880. {
  881.    _global.brojac--;
  882.    if(_global.brojac == 0)
  883.    {
  884.       cilj_x = 100 + random(300);
  885.       cilj_y = 50 + random(200);
  886.       _global.brojac = 14;
  887.       nap_x = (cilj_x - _root.boss1._x) / 100;
  888.       nap_y = (cilj_y - _root.boss1._y) / 100;
  889.    }
  890.    i = 1;
  891.    while(i < 6)
  892.    {
  893.       _root.boss1._y += nap_y;
  894.       _root.boss1._x += nap_x;
  895.       i++;
  896.    }
  897. }
  898. function boss_cilj()
  899. {
  900.    _global.bos_pucanje_timer--;
  901.    if(_global.bos_pucanje_timer == 0)
  902.    {
  903.       _global.f *= -1;
  904.       _global.bos_pucanje_timer = 3;
  905.       _global.boss_m = _global.boss_m + 1;
  906.       if(_global.boss_m == 10)
  907.       {
  908.          _global.boss_m = 1;
  909.       }
  910.       duplicateMovieClip(_root.al_m,"boss_m" + _global.boss_m,16384 + (2660 + _global.boss_m));
  911.       _root["boss_m" + _global.boss_m]._y = _root.boss1._y + 65;
  912.       _root["boss_m" + _global.boss_m]._x = _root.boss1._x + 25 * _global.f;
  913.       x_razlika = _root.ja._x - _root["boss_m" + _global.boss_m]._x;
  914.       y_razlika = _root.ja._y - _root["boss_m" + _global.boss_m]._y;
  915.       y_br_koraka = Math.abs(y_razlika * 0.5);
  916.       x_br_koraka = Math.abs(x_razlika * 0.5);
  917.       srednji_br_koraka = Math.round((x_br_koraka + y_br_koraka) / 2);
  918.       _global["nap_x_boss_m" + _global.boss_m] = x_razlika / srednji_br_koraka;
  919.       _global["nap_y_boss_m" + _global.boss_m] = y_razlika / srednji_br_koraka;
  920.    }
  921. }
  922. function boss_m_kretanje()
  923. {
  924.    i = 1;
  925.    while(i < 12)
  926.    {
  927.       _root["boss_m" + i]._y += _global["nap_y_boss_m" + i] * 5;
  928.       _root["boss_m" + i]._x += _global["nap_x_boss_m" + i] * 5;
  929.       if(Math.abs(_root["boss_m" + i]._y - _root.ja._y) < 50)
  930.       {
  931.          if(_root["boss_m" + i].hitTest(_root.ja))
  932.          {
  933.             if(_root.ja._currentframe == 1)
  934.             {
  935.                fire.start();
  936.                _root.skindanje_hitpoena("boss_metak","hit_poen");
  937.                removeMovieClip(_root["boss_m" + i]);
  938.             }
  939.             if(_root.ja._currentframe == 2)
  940.             {
  941.                fire.start();
  942.                _root.skindanje_hitpoena("boss_metak","stit");
  943.                removeMovieClip(_root["boss_m" + i]);
  944.             }
  945.          }
  946.       }
  947.       i++;
  948.    }
  949. }
  950. function kretanje_oblaka()
  951. {
  952.    _root.t1._y += 10;
  953.    _root.t2._y += 10;
  954.    _root.t3._y += 10;
  955.    if(_root.t1._y > 500)
  956.    {
  957.       _root.t1._y = _root.t3._y - 395;
  958.       e = 1;
  959.       while(e < 4)
  960.       {
  961.          _root.t1["rif" + e]._y = random(400);
  962.          _root.t1["rif" + e]._x = random(300);
  963.          e++;
  964.       }
  965.    }
  966.    if(_root.t2._y > 500)
  967.    {
  968.       _root.t2._y = _root.t1._y - 395;
  969.       e = 1;
  970.       while(e < 4)
  971.       {
  972.          _root.t2["rif" + e]._y = random(400);
  973.          _root.t2["rif" + e]._x = random(300);
  974.          e++;
  975.       }
  976.    }
  977.    if(_root.t3._y > 500)
  978.    {
  979.       _root.t3._y = _root.t2._y - 395;
  980.       e = 1;
  981.       while(e < 4)
  982.       {
  983.          _root.t3["rif" + e]._y = random(300);
  984.          _root.t3["rif" + e]._x = random(400);
  985.          e++;
  986.       }
  987.    }
  988. }
  989. _global.lives = 3;
  990. _global.pocetak = 50;
  991. _global.moji_hitpoeni = 75;
  992. _global.poginuo = false;
  993. _global.keyCont = true;
  994. _global.flag_life = 0;
  995. _global.bombi_u_sarzeru = 1;
  996. _global.beama_u_sarzeru = 1;
  997. strelk1 = new Sound();
  998. strelk1.attachSound("STRELK");
  999. strelk1.setVolume(10);
  1000. moj_strelk = new Sound();
  1001. moj_strelk.attachSound("strelk2");
  1002. moj_strelk.setVolume(20);
  1003. thumph = new Sound();
  1004. thumph.attachSound("thumphi");
  1005. thumph.setVolume(100);
  1006. fire = new Sound();
  1007. fire.attachSound("fire2");
  1008. fire.setVolume(20);
  1009. explode = new Sound();
  1010. explode.attachSound("explode3");
  1011. explode.setVolume(10);
  1012. _root.bazaKraj1.swapDepths(2551);
  1013. _root.baza.swapDepths(2550);
  1014. _root.teleportT.swapDepths(998);
  1015. _root.ja.swapDepths(999);
  1016. _root.glava1.swapDepths(2549);
  1017. _root.pripravise1.swapDepths(2548);
  1018. _global.pauza = 0;
  1019. _global.unpauza = 0;
  1020. _global.loop = true;
  1021. _global.boss1_hitpoeni = 60;
  1022. _global.bos_pucanje_timer = 52;
  1023. _global.f = 1;
  1024. _global.boss_m = 1;
  1025. _global.brojac = 28;
  1026. _global.srednji_flag = 1;
  1027. _global.srednji_timer = 250;
  1028. _global.sr_p_timer = 60;
  1029. _global.unistenih_au = 0;
  1030. _global.unistenih_av = 0;
  1031. _global.unistenih_atg_l = 0;
  1032. _global.br_teleporta = 6;
  1033. _root.osvezi_8();
  1034. _root.osvezi_atg_l();
  1035. _root.osvezi_au();
  1036. _global.br_metkova = 1;
  1037. _global.m_depth = 500;
  1038. _global.brojac_space = 0;
  1039. _global.snap_random = 10;
  1040. _global.pucanje = 28;
  1041. _global.ispaljenih_al_m = 0;
  1042. _global.teleport = false;
  1043. _global.al_niz_br = [1,2,3,4,5,6,7,8,9];
  1044. _global.al_niz = ["x","av1","av2","av3","au1","au2","au3","atg_l1","atg_l2","atg_l3"];
  1045. stop();
  1046. p;
  1047.